﻿Public Class Game
    Inherits System.Web.UI.Page

    Public Property CurrentGameID As ObjectId

        Get

            If HttpContext.Current.Session("CurrentGameID") Is Nothing Then

                ViewState("CurrentGameID") = ObjectId.Empty

            Else

                ViewState("CurrentGameID") = HttpContext.Current.Session("CurrentGameID")
                HttpContext.Current.Session("CurrentGameID") = Nothing

            End If

            Return ViewState("CurrentGameID")

        End Get

        Set(value As ObjectId)

            ViewState("CurrentGameID") = value

        End Set

    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Try

            'If CurrentGameID <> ObjectId.Empty Then

            'Get current game
            'Call GetGame()

            'Load Map and any variables we need
            Call LoadMap()

            'End If

        Catch ex As Exception

        End Try

    End Sub

    Protected Sub LoadMap()

        Dim srReader As System.IO.StreamReader = Nothing

        Try

            srReader = New System.IO.StreamReader(Server.MapPath("/Maps/Basic.svg"))

            Dim strString As String = srReader.ReadToEnd

            divMapContainer.InnerHtml = strString

            srReader.Close()
            srReader.Dispose()

        Catch ex As Exception

        End Try

    End Sub

End Class